package team.seekers.hula.common.entity.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;
import lombok.Getter;

import java.util.Arrays;

/**
 * @author ekin
 * @Description GOOD
 * @mood happy
 */
@Getter
public enum IslandMemoryTypeEnum implements IEnum<Integer> {
    TIME_SPACE(0, "TIME_SPACE", "时空"),
    WE(1, "WE", "我们"),
    MY(2, "MY", "自我");

    private int type;

    private String name;

    private String cnName;

    IslandMemoryTypeEnum(int type, String name, String cnName) {
        this.type = type;
        this.name = name;
        this.cnName = cnName;
    }

    @Override
    public Integer getValue() {
        return this.type;
    }

    public static IslandMemoryTypeEnum getByType(int type) {
        return Arrays.stream(values()).filter(e -> e.getType() == type).findFirst().orElse(null);
    }

    public static IslandMemoryTypeEnum getByName(String name) {
        return Arrays.stream(values()).filter(e -> e.getName().equals(name)).findFirst().orElse(null);
    }
}
